if(!window.console || !window.console.firebug) {

var names = ['log', 'debug', 'info', 'warn', 'error', 'assert', 'dir', 'dirxml',
	'group', 'groupEnd', 'time', 'timeEnd', 'count', 'trace', 'profile', 'profileEnd'];
	
window.console = {};
for (var i=0, len=names.length; i<len; i++) {
	window.console[names[i]] = function() {};
}

if(0) {
	
	console.margin = 0;
	
	console.wnd = window.open('', 'console', 'scrollbars=1,status=0,toolbars=0,resizable=1');
	
	if(console.wnd) {
	
		console.wnd.document.body.innerHTML = '';
		
		console.group = function() {
			var msg = [], i=0;
			while(arguments[i] != undefined) {
				msg.push(arguments[i++]);
			}
			
			var div = this.wnd.document.createElement('div');
			div.innerHTML = msg.join('; ');
			div.style.fontWeight = 'bold';
			div.style.marginLeft = this.margin + 'px';
			
			this.wnd.document.body.appendChild(div);
			this.margin += 10;
		};
		
		console.groupEnd = function() {
			this.margin = Math.max(this.margin - 10, 0);
		};
		
		console.logMsg = function() {
			
			var msg = [];
			var lvl = false;
			
			for(var i=0, len=arguments.length - 1; i<len; i++) {
				msg.push(arguments[i]);
			}
			lvl = arguments[arguments.length-1];
				
			var color, bckColor, img;
			switch(lvl) {
				case 'log':
				color = '#000';
				bckColor = '#FFF';
				img = false;
				break;
				
				case 'debug':
				color = '#00F';
				bckColor = '#FFF';
				img = false;
				break;
				
				case 'info':
				color = '#00F';
				bckColor = '#FFF';
				img = '/js_includes/firebug/infoIcon.png';
				break;
				
				case 'warn':
				color = '#000';
				bckColor = '#FF8082';
				img ='/js_includes/firebug/warningIcon.png';
				break;
				
				case 'error':
				color = '#F00';
				bckColor = '#FF8082';
				img = '/js_includes/firebug/errorIcon.png';
				break;
				
				default:
				throw new Error('unkown log level - ' + lvl);
			}
		
			var div = this.wnd.document.createElement('div');
			div.innerHTML = (img ? "<img src='" + img + "' />" : '') + msg.join(' ; ');
			div.style.marginLeft = this.margin + 'px';
			div.style.color = color;
			div.style.backgroundColor = bckColor;
		
			this.wnd.document.body.appendChild(div);
			
			this.wnd.scrollTo(0, div.offsetTop + div.offsetHeight);
			
		};
		
		var names = ['log', 'debug', 'info', 'warn', 'error'];
	
		for(var i=0, len=names.length; i<len; i++) {
			console[names[i]] = toolbox.delegate(console.logMsg, console, names[i]);
		}
	
	} // end if console.wnd

} // end if(true|false)
} // end if !window.console
